
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <stdio.h>
#include <math.h>
#include <libplayerc++/playerc++.h>
#include "args.h"
#define RAYS 32
#include <time.h>
#include <signal.h>
#include <ctime>	
#include <sys/time.h>


using namespace std;
using namespace PlayerCc;
FILE *locFile;
vector<double> Derror,Aerror;
int main(int argc, char** argv){


locFile=fopen("output_data/loc-11233020108.txt","r");
printf("loading position from file \n");
	float x,y,t,xS,yS,tS,scart,dErr,aErr;
while (!feof(locFile)) {
fscanf(locFile,"%f",&x);
fscanf(locFile,"%f",&y);
fscanf(locFile,"%f",&t);

fscanf(locFile,"%f",&xS);
fscanf(locFile,"%f",&yS);
fscanf(locFile,"%f",&tS);

fscanf(locFile,"%f",&scart);
fscanf(locFile,"%f",&scart);


	 dErr=sqrt((xS-x)*(xS-x)+(yS-y)*(yS-y));
	 aErr=t-tS;
Derror.push_back(dErr);
Aerror.push_back(aErr);


printf("reali: [%f,%f,%f] stimati: [%f,%f,%f], ERROR:[%f,%f]\n",x,y,t,xS,yS,tS,dErr,aErr);

}
printf("vettore errori: \n");

float media,max,sum;
int vsize=Derror.size();
sum=0;
max=0;
for (int y =0;y<vsize;y++){
sum=sum+Derror[y];
if(Derror[y]>max){
max=Derror[y];
}
printf("[%f,%f]\n",Derror[y],Aerror[y]);

}
media=sum/vsize;

printf("STATISTICHE[max,media]: [%f,%f]\n",max,media);



//}

	fclose(locFile);

}
